package cn.hpclub.server.validator.admin;

import com.jfinal.core.Controller;
import com.jfinal.validate.Validator;

import cn.hpclub.server.controller.admin.VideoController;

public class VideoValidator extends Validator{

    private static final String VIDEO_NAME_MESSAGES = "videoNameMessages";
    private static final String VIDEO_SORT_MESSAGES = "videoSortMessages";

    @Override
    protected void validate(Controller c){
        validateRequiredString("name", VIDEO_NAME_MESSAGES, "名称不能为空");
        this.setShortCircuit(true);
        validateRequiredString("sort", VIDEO_SORT_MESSAGES, "排序不能为空");

    }

    @Override
    protected void handleError(Controller c){
        c.keepPara();
        c.render(VideoController.HTML_INPUT);
    }
}
